package com.yanqu.road.server.cmd.activity.unionwar;

import com.yanqu.road.pb.activity.unionwar.UnionWarActivityServerProto;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.command.Command;
import com.yanqu.road.server.manger.activity.unionwar.UnionPhaseWarMgr;
import com.yanqu.road.server.manger.activity.unionwar.UnionWar;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.server.protocol.GameProtocol;
import io.netty.channel.ChannelHandlerContext;

/**
 * @author ：zfr
 * @date ：2022/3/21 16:45
 */
@Cmd(code = GameProtocol.S_UNION_WAR_CROSS_SYNC_ALL_DETAIL, desc = "跨服同步全部的备战数据")
public class UnionWarSyncAllDetailFromCrossCmd implements Command {
    @Override
    public void execute(ChannelHandlerContext ctx, YanQuMessage packet) throws Exception {
        UnionWarActivityServerProto.CrossUnionWarDetailSync syncMsg = UnionWarActivityServerProto.CrossUnionWarDetailSync.parseFrom(packet.getBytes());
        UnionWar unionWar = UnionPhaseWarMgr.getUnionWarMap().get(syncMsg.getActivityId());
        if(unionWar != null){
            unionWar.syncAllUnionDetailFromCross(syncMsg);
        }
    }
}
